import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/hall',
    name: 'home',
    component: HomeView,
    children:[
      {
        path: 'hall',
        name: 'hall',
        component: () => import('../components/home/HomeMainRightSide')
      },
      {
        path: 'loveStory',
        name: 'loveStory',
        component: () => import('../views/LoveStory')
      },
      {
        path: 'memory',
        name: 'memory',
        component: () => import('../views/MemoryView')
      },
      {
        path: 'letter',
        name: 'letter',
        component: () => import('../views/LetterView')
      },
      {
        path: 'food',
        name: 'food',
        component: () => import('../views/FoodView')
      },
      {
        path: 'location',
        name: 'location',
        component: () => import('../views/LocationView')
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/LoginView')
  },
  {
    path: '/posted',
    name: 'posted',
    component: () => import('../views/PostedView')
  },
  {
    path: '/detail',
    name: 'detail',
    component: () => import('../views/DetailsView')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
